﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 委托
{
    class You
    {
        int moodValue;
        //public MoodDelegate md;
        public event MoodDelegate md;

        public You(int moodValue)
        {
            this.moodValue = moodValue;
        }

        public void meetDif()
        {
            Console.WriteLine("遇困难,心情{0}",moodValue);
            moodValue -= 10;

            if(md != null)
            {
                md(ref moodValue);
            }

            Console.WriteLine("心情{0}", moodValue);
        }


    }
}
